import * as api from "../../../api/gw/index.js";
import axios from "axios";
//获取活动名称
export const getActivityName = function () {
    let options = {
        url: window.api.base_host + api.ACTIVITY_NAME + `/${window.api.enterpriseCode}`,
        type: 'get',
        headers: {sessionId: getCookie("sessionId")}
    }
    // return new Promise ((resolve, reject) => {
    //     axios(options).then(data => {
    //         console.log(data);
    //         resolve(data);
    //     }).catch(err => {
    //         resolve(err);
    //     });
    // });
    return  axios(options);
}

//根据活动名称返回具体的活动列表
export const getActivityList = function (name) {
    let options = {
        url: window.api.base_host + api.ACTIVITY_NORMAL + `?saleType=${name}`,
        type: 'get',
        headers: {sessionId: getCookie("sessionId")}
    }
    if (name === "regularPackage") {
        options.url = window.api.base_host + api.ACTIVITY_REGULAR;
    } else if (name === "fixedPackage") {
        options.url = window.api.base_host + api.ACTIVITY_FIXED;
    }
    return axios(options);
    
}